import instance from '../axios/index'

//获取数据

export const getShangData = async (page:any,pageNum:any) => {
    const res = await instance.get(`/Goods/goodsList?page=${page}&pageNum=${pageNum}`)
    return res
}

//添加功能
export const addShangData = async (data:any) => {
   console.log(data);
   
    const res = await instance.post('/Goods/addGoods',data)
    console.log(res)
    return res
}


//调用分类
export const getShangType = async () => {
    const res = await instance.post('Goods/goodsCategory')
    return res.data.data
}

//删除
export const delShangData = async (id:any) => {
    const res = await instance.post(`Goods/deleteGoods?id=${id}`)
    return res.data.data
}

//回显功能
export const getShangId = async (id:any) => {
    const res = await instance.post(`Goods/editGoods?id=${id}`)
    return res.data.data
}

//修改
export const editShangData = async (data:any) => {
    const res = await instance.post('Goods/editGoodsTo',data)
    return res.data.data
}


//设置单品
export const setDanData = async (data:any) => {
   
    
    const res = await instance.post('Goods/danGoods',data)
    return res.data.data
}


//设置上新
export const setShangData = async (data:any) => {
    const res = await instance.post('Goods/shangxinGoods',data)
    return res.data.data
}

//设置精选
export const setJingData = async (data:any) => {
    const res = await instance.post('Goods/jingxuanGoods',data)
    return res.data.data
}

//设置上下架
export const setUpData = async (data:any) => {
    const res = await instance.post('Goods/shangGoods',data)
    return res
}
